import request from '@/utils/request'

/**
 * 获取组织架构列表
 */
export function getDepartmentsList() {
  return request({
    url: '/company/department'
  })
}

/**
 * 删除部门
 * @param {*} id  删除部门的id
 */
export function removeDepartments(id) {
  return request({
    url: '/company/department/' + id,
    method: 'DELETE'
  })
}

/**
 * 新增部门
 * @param {object} data {code, introduce}
 */
export function addDepartments(data) {
  return request({
    url: '/company/department',
    method: 'POST',
    data
  })
}

/**
 * 根据id获取部门数据
 * @param {*} id 部门id
 */
export function getDepartmentsBYId(id) {
  return request({
    url: '/company/department/' + id,
    method: 'GET'
  })
}

/**
 * 部门添加 编辑
 * @param {*} data
 */
export function editDepartmentsBYId(data) {
  return request({
    url: '/company/department/' + data.id,
    method: 'PUT',
    data
  })
}
